package a20.com.yuejian_20.activity;

import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.widget.LinearLayout;

import a20.com.yuejian_20.R;

public class SplashActivity extends AppCompatActivity {

     AnimationDrawable animationDrawable;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_splash);
        animationDrawable = new AnimationDrawable();
        animationDrawable.addFrame(getResources().getDrawable(R.drawable.a1),1500);
        animationDrawable.addFrame(getResources().getDrawable(R.drawable.a2),1500);
        animationDrawable.addFrame(getResources().getDrawable(R.drawable.a3),1500);
        animationDrawable.addFrame(getResources().getDrawable(R.drawable.a4),1500);
        LinearLayout dongtu =(LinearLayout) findViewById(R.id.activity_main);
        dongtu.setBackground(animationDrawable);
        this.startPic();
    }
    public void startPic(){
        animationDrawable.start();
    };

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        Intent intent = new Intent(this,LoginActivity.class);
        startActivity(intent);
        return super.onTouchEvent(event);
    }
}
